from computerconfiguration import *

# Windows XP required modules
from win32com.client import Dispatch

from win32com.shell import shell, shellcon

class WindowsXPConfiguration( ComputerConfiguration ):
	def createDesktopLink( self, link ):
		# Create the link on desktop
		try:
			desktopDir = shell.SHGetFolderPath (0, shellcon.CSIDL_DESKTOP, None, 0)
	 
			path = desktopDir + u"\\%s.lnk" % (link.name)
		
			target = link.target
			# Working dir
			# wDir = u""
			icon = link.icon
	 
			shell = Dispatch('WScript.Shell')
			shortcut = shell.CreateShortCut(path)
			shortcut.Targetpath = target
			shortcut.WorkingDirectory = wDir
			#shortcut.IconLocation = icon
			shortcut.save()
		except Exception, ex:
			print ex
	
	def setWallpaper(self, wallpaper):
		pass
	
	def getCurrentUserHome(self):
		df = shell.SHGetDesktopFolder()
		pidl = df.ParseDisplayName(0, None,  "::{450d8fba-ad25-11d0-98a8-0800361b1103}")[1]
		mydocs = shell.SHGetPathFromIDList(pidl)
		
		return mydocs
		
